﻿<%@ Page Title="Machine Details" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="MachineStatus.aspx.cs" Inherits="admin_MachineStatus" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
    <link href="../styles/admin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <div id="top_menu">
        <div id="help_button">
            help
        </div>
                  <div id="logout">
            <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="../Default.aspx"
                OnLoggingOut="LoginStatus1_LoggingOut" />
        </div>
    </div>
    <div id="page_title">
        ADMINISTRATION
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="left_content">
        <div class="menu">
            <ul>
                <li><a href="Home.aspx">Home</a></li>
                <li><a href="Mng_Client.aspx">Manage Clients</a></li>
                <li><a href="Mng_Site.aspx">Manage Sites</a></li>
                <li><a href="#" class="current">View Machine Details</a></li>
                <li><a href="Mng_Comp.aspx">Manage Components</a></li>
                <li><a href="Mng_Report.aspx">Manage Reports</a></li>
                <li><a href="Mng_WO.aspx">Manage Work Order</a></li>
                <li><a href="Mng_FaultsRecom.aspx">Manage Faults Recommendation</a></li>
            </ul>
        </div>
    </div>
    <!-- end of left content -->
    <div id="right_content">
        <div class="content_area">
            <h2>
                Machine Details
            </h2>
            <div class="form_box1">
                <%--<asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager2" runat="server"></asp:ScriptManager>--%>
                <asp:FormView ID="FormViewMachines" runat="server" DataKeyNames="machine_id" DataSourceID="MachinesObjectDataSource"
                    OnDataBound="FormViewMachines_DataBound">
                    <EditItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Machine ID:
                                </td>
                                <td>
                                    <asp:Label ID="machine_idLabel1" runat="server" Text='<%# Eval("machine_id") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Machine Name:
                                </td>
                                <td>
                                    <asp:TextBox ID="machineNameTextBox" runat="server" Text='<%# Bind("machineName") %>'
                                        CssClass="fields" />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site Name:
                                </td>
                                <td>
                                    <asp:DropDownList ID="siteNameDropDownList" runat="server" DataSourceID="SitesObjectDataSource"
                                        DataTextField="siteName" DataValueField="site_id" SelectedValue='<%# Bind("site_id") %>'
                                        CssClass="dropDownList">
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="SitesObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                                        SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.SitesTableAdapter">
                                    </asp:ObjectDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status:
                                </td>
                                <td>
                                    <asp:DropDownList ID="statusDropDownList" runat="server" SelectedValue='<%# Bind("status") %>'
                                        CssClass="dropDownList">
                                        <asp:ListItem Text="Activated" Value="Activated"></asp:ListItem>
                                        <asp:ListItem Text="Deactivated" Value="Deactivated"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Photo:
                                </td>
                                <td>
                                    <asp:FileUpload ID="photoFileUpload" runat="server" />
                                    <asp:Button ID="uploadButton" runat="server" Text="upload" OnClick="uploadButton_Click" />
                                    <asp:Button ID="removeButton" runat="server" Text="remove" OnClick="removeButton_Click"
                                        Visible="False" /><br />
                                    <asp:Label ID="statusLabel" runat="server"></asp:Label><br />
                                    <asp:Image ID="photoImage" runat="server" /><br />
                                    <asp:Label ID="photoLabel" runat="server" Text='<%# Bind("photo") %>' />
                                </td>
                            </tr>
                        </table>
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update" CssClass="buttons" OnClick="UpdateButton_Click" />
                        <br />
                        <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel" CssClass="buttons" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <table>
                            <tr>
                                <td class="label">
                                    Machine ID:
                                </td>
                                <td class="label">
                                    <asp:Label ID="machine_idLabel" runat="server" Text='<%# Eval("machine_id") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Machine Name:
                                </td>
                                <td class="label">
                                    <asp:Label ID="machineNameLabel" runat="server" Text='<%# Bind("machineName") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Site ID:
                                </td>
                                <td class="label">
                                    <asp:Label ID="site_idLabel" runat="server" Text='<%# Bind("site_id") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Status:
                                </td>
                                <td class="label">
                                    <asp:Label ID="statusLabel" runat="server" Text='<%# Bind("status") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="label">
                                    Photo:
                                </td>
                                <td>
                                    <asp:Button ID="removeButton" runat="server" Text="remove" OnClick="removeButton_Click"
                                        Visible="False" />
                                    <asp:Image ID="photoImage" runat="server" /><br />
                                    <asp:Label ID="photoLabel" runat="server" Text='<%# Bind("photo") %>' />
                                </td>
                            </tr>
                        </table>
                        <br />
                        <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Edit" Visible="false" CssClass="buttons" />
                    </ItemTemplate>
                </asp:FormView>
                <br />
                <table id="selectedtable" runat="server">
                    <tr valign="top">
                        <td>
                            &nbsp;Date Recorded:&nbsp;
                            <asp:DropDownList ID="DropDownList1" AutoPostBack="true" runat="server" DataTextField="clientName"
                                DataValueField="clientid" Height="20px" Width="145px" OnSelectedIndexChanged="DropDownList_IndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <asp:ObjectDataSource ID="MachinesObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetDataByMachineID" TypeName="DataAccess.i2iPortalTableAdapters.MachinesTableAdapter"
                    UpdateMethod="Update">
                    <UpdateParameters>
                        <asp:Parameter Name="site_id" Type="Int32" />
                        <asp:Parameter Name="machineName" Type="String" />
                        <asp:Parameter Name="status" Type="String" />
                        <asp:Parameter Name="photo" Type="String" />
                        <asp:Parameter Name="Original_machine_id" Type="Int32" />
                    </UpdateParameters>
                    <SelectParameters>
                        <asp:QueryStringParameter Name="machine_id" QueryStringField="machine_id" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:SqlDataSource ID="SqlDataSourceDateEntered" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="SELECT DISTINCT ComponentStatus.dateEntered 
                                                FROM ComponentStatus , Components , Machines 
                                                WHERE ComponentStatus.component_id = Components.component_id 
                                                AND Components.machine_id = Machines.machine_id
                                                AND (Components.machine_id = @id)
                                                Order by ComponentStatus.dateEntered desc">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="id" QueryStringField="id" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br />
                <asp:PlaceHolder ID="Component1" runat="server" Visible="True">
                    <div class="components">
                        <table>
                            <tr>
                                <td colspan="3">
                                    <h4>
                                        <asp:Label ID="ComponentName1" runat="server"></asp:Label>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td class="comps_btns">
                                    <asp:HyperLink ID="HyperLink1Oil" Visible="false" runat="server" Text="View Oil Report"
                                        CssClass="link"></asp:HyperLink>
                                </td>
                                <td class="comps_btns">
                                </td>
                                <td class="comps_btns">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="CurrentLabel1" runat="server" Text="Current" CssClass="current"></asp:HyperLink>
                                    <asp:Label ID="Description1" runat="server" CssClass="description">
                                    </asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="PreviousLabel1" runat="server" Text="Previous" CssClass="previous"></asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                        <%--
                    <h4>
                        <asp:Label ID="ComponentName1" runat="server"></asp:Label>
                    </h4>
                    <div class="comps_btns">
                        <asp:HyperLink ID="HyperLink1Oil" Visible="true" runat="server" Text="View Oil Report"
                            CssClass="link"></asp:HyperLink>
                    </div>
                    <asp:HyperLink ID="CurrentLabel1" runat="server" Text="Current" CssClass="current"
                        BackColor="#66FF33"></asp:HyperLink>
                    <asp:Label ID="Description1" runat="server" CssClass="description" BackColor="#66FF33">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
                    </asp:Label>
                    <asp:HyperLink ID="PreviousLabel1" runat="server" Text="Previous" CssClass="previous"></asp:HyperLink>
                --%>
                    </div>
                </asp:PlaceHolder>
                <asp:PlaceHolder ID="Component2" runat="server" Visible="True">
                    <div class="components">
                        <table>
                            <tr>
                                <td colspan="3">
                                    <h4>
                                        <asp:Label ID="ComponentName2" runat="server"></asp:Label>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td class="comps_btns">
                                    <asp:HyperLink ID="HyperLink2Oil" Visible="false" runat="server" Text="View Oil Report"
                                        CssClass="link"></asp:HyperLink>
                                </td>
                                <td class="comps_btns">
                                </td>
                                <td class="comps_btns">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="CurrentLabel2" runat="server" Text="Current" CssClass="current"></asp:HyperLink>
                                    <asp:Label ID="Description2" runat="server" CssClass="description">
                                    </asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="PreviousLabel2" runat="server" Text="Previous" CssClass="previous"></asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                    </div>
                </asp:PlaceHolder>
                <asp:PlaceHolder ID="Component3" runat="server" Visible="False">
                    <div class="components">
                        <table>
                            <tr>
                                <td colspan="3">
                                    <h4>
                                        <asp:Label ID="ComponentName3" runat="server"></asp:Label>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td class="comps_btns">
                                    <asp:HyperLink ID="HyperLink3Oil" Visible="false" runat="server" Text="View Oil Report"
                                        CssClass="link"></asp:HyperLink>
                                </td>
                                <td class="comps_btns1">
                                </td>
                                <td class="comps_btns">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="CurrentLabel3" runat="server" Text="Current" CssClass="current"></asp:HyperLink>
                                    <asp:Label ID="Description3" runat="server" CssClass="description">
                                    </asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="PreviousLabel3" runat="server" Text="Previous" CssClass="previous"></asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                    </div>
                </asp:PlaceHolder>
                <asp:PlaceHolder ID="Component4" runat="server" Visible="False">
                    <div class="components">
                        <table>
                            <tr>
                                <td colspan="3">
                                    <h4>
                                        <asp:Label ID="ComponentName4" runat="server"></asp:Label>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td class="comps_btns">
                                    <asp:HyperLink ID="HyperLink4Oil" Visible="false" runat="server" Text="View Oil Report"
                                        CssClass="link"></asp:HyperLink>
                                </td>
                                <td class="comps_btns1">
                                </td>
                                <td class="comps_btns">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="CurrentLabel4" runat="server" Text="Current" CssClass="current"></asp:HyperLink>
                                    <asp:Label ID="Description4" runat="server" CssClass="description"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:HyperLink ID="PreviousLabel4" runat="server" Text="Previous" CssClass="previous"></asp:HyperLink>
                                </td>
                            </tr>
                        </table>
                    </div>
                </asp:PlaceHolder>
            </div>
        </div>
        <asp:LinkButton ID="BackButton" runat="server" PostBackUrl="Mng_Machine.aspx" CssClass="backbtn">Back</asp:LinkButton>
    </div>
    <!-- end of right content -->
</asp:Content>
